<?php

Frodo::import("com.events.EventDispatcher");
Frodo::import("com.events.EventListener");

abstract class Component extends EventDispatcher{
	
	protected $_prototype,
			  $_document,
			  $_name,
			  $_value,
			  $_parent;
	
	
	
	/**
	 * Enter description here...
	 *
	 * @var ArrayObj
	 */
					  
	public function __construct($prototype){
		parent::__construct();
		$this->_prototype=$prototype;
		if($prototype!=null&&$prototype->attributes!=null)
		{
			$this->setName($prototype->getAttribute("name"));
			$this->setValue($prototype->getAttribute("value"));
		}
		//$this->_document = $document;
	}
	
	public function setDocument($document){
		$this->_document=$document;
	}
	
	public function init(){
		$this->_children=new ArrayObj(array());
		$this->createChildren();
	}
	
	abstract function asNode();
	
	public function getName(){
		return $this->_name;
	}
	public function setName($name){
		$this->_name = $name;
	}
	
	public function setValue($value){
		$this->_value=$value;
	}
	
	public function getValue(){
		return $this->_value;
	}
}

?>